package com.mvu.banana.common.client;

import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasName;
import com.google.gwt.user.client.ui.Widget;

/**
 * Class description...
 *
 * @author gantz
 */
public class InputColumn extends Grid {
  public InputColumn(Widget... inputs){
    super(inputs.length, 2);
    // Put some values in the grid cells.
    for (int row = 0; row < inputs.length; row++) {
      Widget input = inputs[row];
      if(input instanceof HasName){
        String name = ((HasName) input).getName();
        name = CommonConstants.get.getString(name);
        setText(row, 0, name + ":");
        getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
      }
      setWidget(row, 1, input);
    }
  }
}
